/**
 * Created by XuQiang on 2017/6/2.
 */
import React from 'react';
import {connect} from 'dva';
import  {Link}from 'dva/router'
import {injectIntl, defineMessages} from 'react-intl';
import {Button} from  'antd-mobile'
import {log} from  '../../utils/log'

function Menu({dispatch, loading, user}) {
  const handleClick = () => {
    dispatch({
      type: 'login/changeBg',
      value: 123,
    })
  }
  const handleIndex = () => {
    dispatch({
      type: 'login/pushRouter',
      payload: 'index',
    })
  }
  const text = loading ? "" : "click"
  return (
    <div>
      app menu
      <Link to="/app/index">index </Link>
      <Link to="/app/test">123 </Link>
      {user.map(n => <div key={n * 3}>{n}</div>)}
      <Button loading={loading} onClick={handleClick}>{text}</Button>
      <Button onClick={handleIndex}>to index</Button>
    </div>
  )

}


// function mapStateToProps(stuIndexPage) {
//   return stuIndexPage
// }

export default  connect(state => state.login)(Menu);
